package com.ayi.servlet.backstage; /**
 * @author Ayingzz
 * @create 2021/12/6 23:40
 */

import com.ayi.bean.User;
import com.ayi.dao.userdao.AddUser;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;

@WebServlet(name = "addAdminIntoUsersServlet", value = "/addAdminIntoUsersServlet")
public class addAdminIntoUsersServlet extends HttpServlet {

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String username = request.getParameter("username");
        String password = request.getParameter("password");
        if (new AddUser().addUser(new User(username, password, true, false))) {
            response.sendRedirect("UserManageServlet");
        } else {

        }
    }
}
